<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .lazy-load {
      height: 200vh;
      background-color: antiquewhite;
    }

    .imgs {
      margin-top: 120vh;
    }
  </style>
</head>

<body>
  <div class="lazy-load">
    <img src="https://picsum.photos/300/200" data-src="https://picsum.photos/600/400" alt="图片描述">

    <div class="imgs">
      <img src="https://picsum.photos/300/200" data-src="https://picsum.photos/600/400" alt="图片描述">
      <img src="https://picsum.photos/300/200" data-src="https://picsum.photos/600/400" alt="图片描述">

    </div>
  </div>

  <script src="./1.getBoundingClientRect方式.js">

  </script>

  <script>
    let lazyFun = LazyLoadImg()
    // 开始执行一次，将可视区域的大图显示出来
    lazyFun()
    // 后面滚动时候再判断图片是否出现再滚动区域
    window.addEventListener('scroll', lazyFun)
  </script>
</body>


</html>